// news-system-modern/src/store/features/loadingSlice.ts
import { createSlice } from '@reduxjs/toolkit';
import type { RootState } from '../types';

// 加载状态切片
const loadingSlice = createSlice({
  name: 'loading',
  initialState: false,
  reducers: {
    setLoading: (state, action) => action.payload
  },
});

// 导出actions
export const { setLoading } = loadingSlice.actions;

// 导出选择器
export const selectLoading = (state: RootState) => state.loading;

export default loadingSlice.reducer;